package com.yb.java8.traverse;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class LambdaTest {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("1");
        list.add("2");
        list.add("3");

        list.forEach(item -> System.out.println(item));
        list.forEach(LambdaTest::print);
        //list.stream().forEach(item->System.out.println(item));

        Map<String, Integer> map = new HashMap<>();
        map.put("a", 1);
        map.put("b", 2);
        map.put("c", 3);
        map.forEach((k, v) -> System.out.println("key:" + k + ",value:" + v));
    }

    public static void print(String s) {
        System.out.println(s);
    }
}
